package com.hst.capacity.infra.convertor;

import com.hst.capacity.domain.model.entity.order.intercity.IntercityOrderEntity;
import com.hst.capacity.domain.model.entity.setting.line.CityLineEntity;
import com.hst.capacity.domain.model.entity.setting.line.IntercityLineAutoGrabEntity;
import com.hst.capacity.domain.model.entity.setting.line.IntercityLineEntity;
import com.hst.capacity.domain.model.entity.setting.price.IntercityPriceEntity;
import com.hst.capacity.domain.model.request.setting.line.CityLineParam;
import com.hst.capacity.domain.model.request.setting.line.IcLineSaveParam;
import com.hst.capacity.domain.model.request.setting.line.IntercityLineAutoGrabParam;
import com.hst.capacity.domain.model.request.setting.price.IcSaveParam;
import com.hst.capacity.domain.model.response.PagingResultVO;
import com.hst.capacity.domain.model.response.intercity.IcListNewVO;
import com.hst.capacity.domain.model.response.intercity.dispatch.IcCityLineCountDetail;
import com.hst.capacity.domain.model.response.order.IcOrderInfoVO;
import com.hst.capacity.domain.model.response.order.OrderVO;
import com.hst.capacity.domain.model.response.setting.line.CityLineInfoVO;
import com.hst.capacity.domain.model.response.setting.line.IntercityLineAutoGrabVO;
import com.hst.capacity.domain.model.response.setting.line.IntercityLineInfoVO;
import com.hst.capacity.domain.model.response.setting.line.IntercityLineVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 *  城际订单模块的POJO属性转换器
 *
 * @author jin
 * */
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface IntercityConvertor {

    IntercityConvertor INSTANCE = Mappers.getMapper(IntercityConvertor.class);

    CityLineInfoVO convert(CityLineEntity entity);

    CityLineEntity convert(CityLineParam param);

    IntercityLineEntity convert(IcLineSaveParam param);

    IntercityPriceEntity convert(IcSaveParam param);

    PagingResultVO<IcListNewVO> convert(PagingResultVO<IntercityOrderEntity> expressOrderEntity);

    List<IcCityLineCountDetail.IcCityLineCount> convert(List<CityLineEntity> byIdFranchisee);

    List<IcCityLineCountDetail.OrderDetail> convertOrder(List<IntercityOrderEntity> byIdLineAndStatus);

    IntercityLineVO convertIcLine(IntercityLineEntity entity);

    @Mapping(target="appointmentTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="cutOffTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="assignTime", dateFormat="yyyy-MM-dd HH:mm")
    IcOrderInfoVO convert(IntercityOrderEntity entity);

    @Mapping(target="appointmentTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="cutOffTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="assignTime", dateFormat="yyyy-MM-dd HH:mm")
    OrderVO convert2VO(IntercityOrderEntity entity);

    CityLineInfoVO convert2VO(CityLineEntity entity);

    IntercityLineInfoVO convert2VO(IntercityLineEntity entity);
    List<IntercityLineInfoVO> convert2VOLst(List<IntercityLineEntity> entity);

    @Mapping(target = "idLineAutoGrab", source = "id")
    IntercityLineAutoGrabEntity convert(IntercityLineAutoGrabParam param);

    @Mapping(target = "id", source = "idLineAutoGrab")
    IntercityLineAutoGrabVO convert2VO(IntercityLineAutoGrabEntity entity);

    @Mapping(target = "id", source = "idLineAutoGrab")
    List<IntercityLineAutoGrabVO> convert2LstVO(List<IntercityLineAutoGrabEntity> lst);

}
